<?php
	//@todo verifier si l'utilisateur est root (idem pour afficher ou non le menu)

	$hosts = array();
	foreach($conf['appli']['packages'] as $application_data)
	{
		$hosts[] = $application_data['host'];
	}
	$hosts = array_unique($hosts);
	foreach ($hosts as $host)
	{
		$xml = file_get_contents($application_data['host'].'index.php?action=list_packages');
		if($xml!='')
		{
			$data = @new SimpleXMLElement($xml);
			$packages = array();
			foreach($data->package as $package)
			{
				$packages[''.$package['type']][] = array('name' => ''.$package['name'], 'description' => ''.$package, 'installed' => isset($conf['appli']['packages'][''.$package['name']]));
			}
			$smarty->assign('packages', $packages);
		}
	}
?>